<!doctype html>
<html class="x-admin-sm">
<head>
<meta charset="UTF-8">
<title>后台管理-T-admin1.0</title>
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport"
    content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<link rel="stylesheet" href="../css/font.css">
<link rel="stylesheet" href="../css/login.css">
<link rel="stylesheet" href="../css/xadmin.css">
<link rel="stylesheet" href="../lib/layui/css/modules/layer/default/layer.css"></link>
<script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
<script src="../lib/layui/layui.js" charset="utf-8"></script>
<script src="../lib/layui/lay/modules/layer.js" charset="utf-8"></script>
<!--[if lt IE 9]>
      <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
      <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>
<body class="login-bg">

    <div class="login layui-anim layui-anim-up">
        <div class="message">切换账号</div>
        <div id="darkbannerwrap"></div>

        <input id="username" placeholder="用户名" type="text">
        <hr class="hr15">
        <input id="password" placeholder="密码" type="password">
        <hr class="hr15">
        <input id="submit" value="登录" style="width: 100%;" type="submit">
        <hr class="hr20">
    </div>

    <script>
        $(function() {
            $("#submit").click(
                    function() {
                        var param = {};
                        param.username = $("#username").val();
                        param.password = $("#password").val();
                        console.log("param:" + JSON.stringify(param));
                        $.ajax({
                            async : false, // 表示请求是否异步处理
                            type : "post", // 请求类型
                            url : "../adminLogin",// 请求的 URL地址
                            data : param, // 请求参数
                            dataType : "json",// 返回的数据类型
                            success : function(data) {
                                if (data.isSuccessflag) {
                                    sessionStorage.setItem("username", $("#username").val());
                                    var index = parent.layer.getFrameIndex(window.name);  
                                    setTimeout(function(){
                                        parent.layer.close(index);//关闭弹出层
                                        parent.location.reload();//更新父级页面
                                        //parent.location.href="/activity";//跳转
                                    }, 200);
                                } else {
                                    layer.alert(data.message, {
                                        icon: 5,
                                        title: "提示"
                                    });
                                }
                            },
                            error : function(data) {
                                layer.alert('系统异常!', {
                                    icon: 5,
                                    title: "提示"
                                });
                            }
                        });
                    });
        })
    </script>
</body>
</html>